import {
  Controller,
  Del,
  Get,
  Param,
  Patch,
  Post,
  Put,
  Query,
  Headers,
  Body,
} from '@midwayjs/core';

@Controller('/ultra')
export class UltraController {
  @Get('/showtime')
  async showtime() {
    return new Date().toJSON();
  }
  @Get('/showtime1/:xxx/:age')
  async showtime1(@Param('xxx') username, @Param('age') age) {
    console.log(username, age);
    return new Date().toJSON();
  }
  @Post('/showtime2')
  async showtime2(@Query('name') username, @Query('age') age) {
    console.log(username, age);
    return new Date().toJSON();
  }
  @Put('/showtime3')
  async showtime3(@Headers('name') username, @Headers('age') age) {
    console.log(username, age);
    return new Date().toJSON();
  }
  @Del('/showtime4')
  async showtime4(@Body() person) {
    console.log(person.name, person.age);
    return new Date().toJSON();
  }
  @Patch('/showtime5')
  async showtime5(@Body() person) {
    console.log(person.name, person.age);
    return new Date().toJSON();
  }
}
